package com.craterhill.java.ccp.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.craterhill.java.ccp.common.beans.StudyType;
import com.craterhill.java.ccp.dao.impl.AbstractDao;
import com.craterhill.java.ccp.dao.utils.CCPResultSetExtractor;

public interface StudyTypeDao extends CCPDao<StudyType> {
	public final String FIELD_LIST = "obj.study_type_id, obj.study_type_name" + AbstractDao.MONITER_FIELDS;
	public final String FIND_ALL_STUDYTYPE = " select " + FIELD_LIST + " from study_type obj ";
	
	
	public final class StudyTypeExtractor extends CCPResultSetExtractor <StudyType> {
		
		@Override
		protected StudyType extractResultSetData(ResultSet resultSet) throws SQLException {
			StudyType studytype = new StudyType();
			studytype.setStudyTypeId(resultSet.getInt(1));
			studytype.setStudyTypename(resultSet.getString(2));
			studytype.setStatus(resultSet.getBoolean(3));
			studytype.setCreatedBy(resultSet.getInt(4));
			studytype.setModifiedBy(resultSet.getInt(5));
			studytype.setCreatedDate(resultSet.getDate(6));
			studytype.setModifiedDate(resultSet.getDate(7));
			return studytype;
			
		}
	}

}
